/**
 * Title : jFamilyTree application
 * Description: jFamilyTree application
 * About: Designed and rewritten by Andreas Lundgren, based on the Treebolic application suite
 * Copyright:	(c) 2001-2008
 * Terms of use:see license agreement at http://treebolic.sourceforge.net/en/license.htm
 * Author: Bernard Bou
 * Company: bsys
  */
package jFamilyTree;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

/**
 * About dialog
 * 
 * @author Bernard Bou
 */
public class AboutDialog extends JDialog
{
	private static final long serialVersionUID = 1L;

	/**
	 * Constructor
	 */
	public AboutDialog()
	{
		super();
		initialize();
	}

	/**
	 * Initialize
	 */
	private void initialize()
	{
		JLabel thisTitle = new JLabel();
		thisTitle.setText("jFamilyTree");
		thisTitle.setFont(new Font("Dialog", 1, 18));
		thisTitle.setOpaque(true);
		thisTitle.setBackground(Color.RED);
		thisTitle.setForeground(Color.WHITE);
		thisTitle.setHorizontalAlignment(SwingConstants.CENTER);
		thisTitle.setAlignmentX(Component.CENTER_ALIGNMENT);

		JLabel thisDescription = new JLabel();
		thisDescription.setText("jFamilyTree application");
		thisDescription.setFont(new Font("Dialog", 0, 10));
		thisDescription.setHorizontalAlignment(SwingConstants.CENTER);
		thisDescription.setAlignmentX(Component.CENTER_ALIGNMENT);

		JLabel thisVersion = new JLabel();
		thisVersion.setText("version 2.0");
		thisVersion.setFont(new Font("Dialog", 0, 10));
		thisVersion.setHorizontalAlignment(SwingConstants.CENTER);
		thisVersion.setAlignmentX(Component.CENTER_ALIGNMENT);

		JLabel thisAuthor = new JLabel();
		thisAuthor.setText("Bernard Bou <bbou@ac-toulouse.fr>");
		thisAuthor.setFont(new Font("Dialog", 0, 10));
		thisAuthor.setHorizontalAlignment(SwingConstants.CENTER);
		thisAuthor.setAlignmentX(Component.CENTER_ALIGNMENT);

		JPanel thisPanel = new JPanel();
		thisPanel.setAlignmentX(RIGHT_ALIGNMENT);
		BoxLayout thisLayout = new BoxLayout(thisPanel, BoxLayout.Y_AXIS);
		thisPanel.setLayout(thisLayout);
		thisPanel.add(Box.createVerticalGlue());
		thisPanel.add(thisTitle);
		thisPanel.add(Box.createVerticalGlue());
		thisPanel.add(thisDescription);
		thisPanel.add(thisVersion);
		thisPanel.add(thisAuthor);

		setContentPane(thisPanel);
		pack();
	}

	/**
	 * Main
	 * 
	 * @param theseArgs
	 *        arguments
	 */
	static public void main(String[] theseArgs)
	{
		AboutDialog thisDialog = new AboutDialog();
		thisDialog.setModal(true);
		thisDialog.setVisible(true);
		thisDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		System.exit(0);
	}
}
